home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / variables / array next >
Encoding:
Text File  |  1993-10-26  |  3.2 KB  |  66 lines  |  [TEXT/$Tcl]

  1.  
  2.           array option arrayName ?arg arg ...?
  3.  
  4.  
  5.      DESCRIPTION
  6.           This command performs one of several operations on the vari-
  7.           able  given  by arrayName.  ArrayName must be the name of an
  8.           existing array variable.   The  option  argument  determines
  9.           what  action  is  carried  out  by  the  command.  The legal
  10.           options (which may be abbreviated) are:
  11.  
  12.           array anymore arrayName searchId
  13.                Returns 1 if there are any more  elements  left  to  be
  14.                processed  in  an  array search, 0 if all elements have
  15.                already been returned.  SearchId indicates which search
  16.                on  arrayName  to  check, and must have been the return
  17.                value from a previous invocation of array  startsearch.
  18.                This  option  is particularly useful if an array has an
  19.                element with an empty name, since the return value from
  20.                array nextelement won't indicate whether the search has
  21.                been completed.
  22.  
  23.           array donesearch arrayName searchId
  24.                This command terminates an array  search  and  destroys
  25.                all  the  state  associated with that search.  SearchId
  26.                indicates which search on  arrayName  to  destroy,  and
  27.                must have been the return value from a previous invoca-
  28.                tion of array startsearch.  Returns an empty string.
  29.  
  30.           array names arrayName
  31.                Returns a list containing the names of all of the  ele-
  32.                ments  in  the  array.  If there are no elements in the
  33.                array then an empty string is returned.
  34.  
  35.           array nextelement arrayName searchId
  36.                Returns the name of the next element in  arrayName,  or
  37.                an  empty  string  if  all  elements  of arrayName have
  38.                already been returned in  this  search.   The  searchId
  39.                argument  identifies the search, and must have been the
  40.                return value of an array startsearch command.  Warning:
  41.                if  elements  are  added  to or deleted from the array,
  42.                then all searches are automatically terminated just  as
  43.                if  array  donesearch had been invoked; this will cause
  44.                array  nextelement  operations  to   fail   for   those
  45.                searches.
  46.  
  47.           array size arrayName
  48.                Returns a decimal string giving the number of  elements
  49.                in the array.
  50.  
  51.           array startsearch arrayName
  52.                This command initializes an  element-by-element  search
  53.                through the array given by arrayName, such that invoca-
  54.                tions of the array nextelement command will return  the
  55.                names  of  the  individual elements in the array.  When
  56.                the search has been  completed,  the  array  donesearch
  57.                command  should  be  invoked.   The  return  value is a
  58.                search identifier that must be used in  array  nextele-
  59.                ment  and array donesearch commands; it allows multiple
  60.                searches to be underway  simultaneously  for  the  same
  61.                array.
  62.  
  63.  
  64.      KEYWORDS
  65.           array, element names, search
  66.